package com.zggk.lzz.roadlist;

import android.app.Activity;

import com.alibaba.fastjson.JSON;
import com.zggk.lzz.api.MyApplication;
import com.zggk.lzz.api.Urls;
import com.zggk.lzz.callback.StringDialogCallback;
import com.zggk.lzz.mvp.BasePresenterImpl;
import com.lzy.okgo.OkGo;
import com.lzy.okgo.model.Response;

import java.util.List;

/**
 * MVPPlugin
 *  邮箱 784787081@qq.com
 */

public class RoadListPresenter extends BasePresenterImpl<RoadListContract.View> implements RoadListContract.Presenter{
    @Override
    public void getData(Activity activity) {
        OkGo.<String>post(Urls.JAVASERVER10+"pms/amap/get2021PrjInfoListByPrjSpeed")
                .params("token", "Bearer$" + MyApplication.spUtils.getString("Token",""))
                .params("prjCode", "")
                .params("prjType", "0")
                .params("orgCode", "")
                .params("prjYear", "2021")
                .params("pageNow", "1")
                .params("pageSize", "200")
                .execute(new StringDialogCallback(activity) {
                    @Override
                    public void onSuccess(Response<String> response) {
                        List<RoadListBean> roadListBeans=JSON.parseArray(response.body(),RoadListBean.class);
                        if (mView == null)
                            return;
                        mView.getDatas(roadListBeans);
                    }
                });
    }
}
